package org.jeecg.modules.xl.order.vo;


import cn.hutool.core.util.RandomUtil;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 订单导入模版-订单sheet
 *
 * @author deco
 * @create 2024-10-24
 */
@Data
public class OrderSheet implements Serializable {
    private static final long serialVersionUID = 1L;

    /**订单单号*/
    //@Excel(name = "订单单号", width = 25)
    private String orderCode;
    /**门店编号*/
    @Excel(name = "门店编号，请从门店清单里查询", width = 35)
    @Dict(dictTable = "xl_customer_store_info", dicText = "store_name", dicCode = "store_code")
    private String storeCode;
    /**收件人*/
   // @Excel(name = "收件人", width = 15)
    private String receiptName;
    /**收件人手机号*/
   // @Excel(name = "收件人手机号", width = 15)
    private String receiptPhone;
    /**收件地址省市区*/
   // @Excel(name = "收件地址省市区", width = 15,exportConvert=true,importConvert = true )
    private String receiptZone;

    /**收件详细地址*/
    //@Excel(name = "收件详细地址", width = 15)
    private String receiptAddress;

    @Excel(name = "订单备注", width = 35)
    private String orderNotes;

    @ExcelCollection(name="订单明细")
    private List<OrderSheetDetail> orderDetail;

    private  List<OrderSheet> getTemplateData(){
        OrderSheet orderSheet = new OrderSheet();
        orderSheet.setOrderCode("CG2349814124435");
        orderSheet.setStoreCode("MD304573");
        orderSheet.setOrderNotes("示例数据，导入时请删除这个订单");
        List orderDetail   = new ArrayList<OrderSheetDetail>();
        for(int i = 0;i<5;i++){
            OrderSheetDetail temp = new OrderSheetDetail();
            temp.setProductId(RandomUtil.randomNumbers(8));
            orderDetail.add(temp);
        }
        orderSheet.setOrderDetail(orderDetail);
        List orderSheetLisst   = new ArrayList<OrderSheet>();
        orderSheetLisst.add(orderSheet);
        return orderSheetLisst;
    }
}

